﻿using IS_Ever_Green.DataAccess.Model.Repositories;
using IS_Ever_Green.DataAccess.Model;
using System.Collections.ObjectModel;
using System.Windows.Input;

namespace IS_Ever_Green.ViewModel
{
    public class LaptopViewModel : BaseViewModel
    {
        private IProductRepository _productRepository;
        private ObservableCollection<ProductModel> _laptopList;
        private string _textLaptop;

        public ObservableCollection<ProductModel> LaptopList
        {
            get { return _laptopList; }
            set { _laptopList = value; OnPropertyChanged(nameof(LaptopList)); }
        }

        public string TextLaptop
        {
            get { return _textLaptop; }
            set { _textLaptop = value; OnPropertyChanged(nameof(TextLaptop)); }
        }


        public ICommand AddProductCart { get; }
        public ICommand AddProductLike { get; }
        public ICommand DeleteProductCart { get; }
        public ICommand DeleteProductLike { get; }

        public LaptopViewModel()
        {
            _productRepository = new ProductRepository();

            ShowProductFromLaptop();
        }

        public void ShowProductFromLaptop()
        {
            LaptopList = new ObservableCollection<ProductModel>(_productRepository.GetProductWithCategory(3));
            if (LaptopList.Count != 0)
            {
                TextLaptop = "Ноутбуки";
            }
        }
    }
}
